The potential flow upstream from a contraction in a rectangular flume is analysed. In order to calculate the potential function, the flow is considered as the superposition of sinks uniformly distributed in the contraction. The effect of boundaries is taken into account by introducing virtual sinks. The calculation is performed in the complex plane and provides a closed-form solution of the complex potential function. As an illustration, the effect of contraction size and position is analysed, and the solution is compared to experimental measurements and other numerical solutions for vertical sluice gates.